"Pictures by Funny Numbers" By Frank Dietrich and Zsuzsa Molnar "Creative Computing" (June 1981): 102-107. What do pictures and numbers have in common? Nothing. Unless a computer is used to generate the pictures. Otherwise pictures and numbers live in two separate domains: the image being a concrete visual phenomenon, the number an abstract concept of order, counting or measuring. Since computers deal quickly and efficiently with numbers, they can be used to calculate things like taxes and interest in a straightforward manner. Input is numeric anyway and if the right (not red) numbers appear as the output, the user is satisfied. In order to make images with this machine, one is forced to deal with numbers. Lots of them. The more efficient the computer, the more numbers it requires to be kept busy. Nice ways around this greedy demand for numbers have been developed in paint programs, in which the user draws with the old-fashion but flexible pen on a tablet. The computer picks up the appropriate numbers according to the position of the pen. Or, a TV image is digitized and the machine assigns the digital numbers. In both cases, pen drawing and digitizing, we face again the question we started with: how are numbers and images related? Once an image is in the machine, it is sitting there in the form of numbers, waiting to be processed. We decided to investigate concepts of combinatorics, which have fascinated people since the first minutes of mathematics. The three concepts illustrated here, Vedic and Latin Squares and Permutations, require minimal input, but generate a large variety of change and harmony, two extremely valuable principles in image-making. Implemented on a microcomputer graphics system, the ZGrass UV-1, these number games brought about interesting visual results we'd like to share. In its toolbox of graphic commands, ZGrass provides four basic primitives: POINT, LINE, BOX (filled rectangle) and CIRCLE (filled ellipse). All graphic commands need numerical information for the X and Y location as well as for the color option. Furthermore the width and height of boxes and circles has to be specified to turn bare numbers into visual beauty. Vedic Squares Our idea was to create pictures using sets of numbers which feature harmonic relations. The Vedic Square, a thousand-year-old number game, neatly fulfills these requirements. In the first row and column of a 9x9 square the numbers 1 through 9 are placed consecutively. All remaining numbers are computed by multiplying the values of the respective values of row by column. Each time the product exceeds 9, the number is reduced by forming the sum of the first and second digit, so that the Vedic Square contains only one-digit numbers. Astonishing patterns of numbers can be detected by further examining the square, now stored as a two-dimensional array. The drawing program scans through the rows and columns, relates them to an XY- grid and plots boxes or circles on the TV screen. The size and amount of the graphics depend on the current magic number called from the Vedic square, thus forming subtly symmetrical images. (See Figure 1.) Since the right-hand bottom lines of the square consist only of 9's, we decided to ignore them, leaving an 8x8 drawing square. (See Figure 2.) Magic Squares To the Hindus these numbers revealed hidden secrets of life and time. The Arabs used Magic Squares to represent the astrological constellation of the stars. The numbers are arranged so that the sum of each row or column or diagonal is always the same. Three pictures based on a 4x4 Magic Square, the square of Jupiter, are shown in Figure 3. They are drawn with the method described above for the Vedic Square. In the second, the decision to draw a box or a circle depended on whether the Magic Number was even or odd. For the third image the center of the circles shifted to the right each time a smaller one was overlaid. Other interesting types of squares are the Latin Squares. (See Figure 4.) These are NxN squares filled with numbers ranging from 1 to N in a way that each number is placed only once in a particular row or column. This feature guarantees an equal distribution of numbers, which is why Latin Squares are commonly used in statistics. An initial sequence of random numbers provides all the necessary information to compute the entire square. Once the square is computed and stored as a lookup table, its numbers are called by a drawing routine. This time the numbers specify four different graphic events: First, the size of the boxes and how many are drawn for each number. Even numbers direct the center of the boxes diagonally downwards, odd numbers direct them upwards. Finally, the color depends on whether a number is smaller, equal to or larger than the median of the set. As the images in Figure 3 demonstrate, each Latin Square forms different distributions of the graphic primitives, each exhibiting an internal harmony as well as a visible relation to all the other squares of the same set of numbers. Permutations The mathematics of permutation cycles a basic set of numbers through all of its possible variations. N enumerates the number of permutations or arrangements possible, where N defines the number of elements in the set, as well as setting the range of each individual element of the set from 0 to N. Here is the permutational path of a four element set: 0000 0001 0002 0003 0010 0011....until the 4 numbers produce 256 combinations. Combining permutations with pictures, we can systematically explore how many pictures exist in one single composition. In the ZGrass language a complex user-built pattern can be defined by a high powered primitive, the SNAP. Once a SNAPped picture is given a name, it is stored as one shape in the frame buffer and can be quickly thrown onto the screen. Permutation triggers the rapid animation of a sequence of these image tiles. Each frame draws in two seconds. The basic circle image in the center of Figure 5 generates all the other patterns. It is fragmented into quarters, each of which is given a name: PIC0, PIC1, PIC2, PIC3. These four modules form the image data bank. As the permutation program cycles through the numerical variations, the permutation is applied to the name of the picture. Specified pictures are pulled out of the data bank and recombined to form a new image, which is popped on the screen in four-fold symmetry. Some of the pictures are simply drawn variations of the initial image. The additional complexity and interconnections of other drawings is achieved by using one of ZGrass' fancier drawing modes, the "EXCLUSIVE-OR." These concepts of Magic Squares and Permutation are so general, that they could be used to produce new pictures on any system. We look forward to getting feedback from readers who feel encouraged to give it a try, wandering off into other stimulating regions of Pixelland. Resources Magic Squares: The Language of Pattern, Keith Albarn et al. Thames and Hudson. London & NY 1974. Magic Squares and Cubes, W.S. Andrews, Dover, N.Y. Permutation: The Sense of Order, E.H. Gombrich. Cornell University Press, Ithaca, N.Y., 1979. ZGrass: "Language Control Structures for Easy Electronic Visualization." Tom DeFanti, Byte, Nov. 1980. Vol. 5, No. 11.